#################################################################
#
#				Warninng!!!!
#				============
#	
# this make file compile all the sources with implicit rules
# therfore in order to make sure all the changes were made 
# run it with "make clean all"
#
##################################################################

DEST_DIR ?= ../

include $(DEST_DIR)/common_make.mak

# list of all the sources files
SRCS	=  server.cpp						\
		   client_context.cpp 				\
		   server_request_handler.cpp		

# compiler 
CC	= g++

# linker
LD	= $(CC)
LDFLAGS	=

LIBS = 

EXEC_NAME = $(SERVER_EXEC_NAME)

# include list
INCLUDE = -I../protocol

# rule to change the suffix of the sources files
OBJS	= ${SRCS:.cpp=.o}

# clear out all suffixes
.SUFFIXES:
# list only those we use
.SUFFIXES: .o .cpp

# define a suffix rule for .c -> .o
.cpp.o :
	$(CC) $(CFLAGS) $(INCLUDE) -c $<

##################################
# 	default target 		##
##################################
all : $(EXEC_NAME)

$(EXEC_NAME) : $(OBJS)
	$(LD) $(LDFLAGS) $(LIBS) $(OBJS) -o $(EXEC_NAME)
	mv $(EXEC_NAME) $(DEST_DIR)/$(EXEC_NAME)
	
$(OBJS) : $(SRCS)

.PHONY:
clean :
	rm -f $(OBJS) $(EXEC_NAME) $(DEST_DIR)/*.log $(DEST_DIR)/$(EXEC_NAME)
 
